# Contributor: Patrycja Rosa <alpine@ptrcnull.me>
# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=bettercap
pkgver=2.32.0
pkgrel=5
pkgdesc="The Swiss Army knife for 802.11, BLE and Ethernet networks reconnaissance and MITM attacks"
url="https://www.bettercap.org"
arch="all"
license="GPL-3.0-only"
makedepends="libusb-dev libnetfilter_queue-dev libpcap-dev linux-headers go"
source="https://github.com/bettercap/bettercap/archive/refs/tags/v$pkgver/bettercap-v$pkgver.tar.gz"

export GOPATH="$srcdir"
export GOFLAGS="$GOFLAGS -modcacherw -trimpath"

# github.com/chifflier/nfqueue-go/nfqueue 2017-02-22 does not include
# <sys/types.h> for these types, this is the easiest patch
export CGO_CFLAGS="$CFLAGS -Du_int32_t=uint32_t -Du_int16_t=uint16_t -Du_int8_t=uint8_t"

build() {
	go build -o "$builddir/bettercap" .
}

check() {
	make test
}

package() {
	install -Dm755 "$builddir"/bettercap -t "$pkgdir"/usr/bin
}

sha512sums="
0728d2dab0c0a07fdfd91490f450be46b004ae994024bfdb6ef1b7ecac8044c4c70da9fdf986b9b31033c9698fb63e4f619604095727fb26d9ba2abc233b27d1  bettercap-v2.32.0.tar.gz
"
